@extends('shared.master')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb layout-title">
                                    <li class="active" ><i class="fa fa-suitcase fa-fw"></i> Project</li>
            </ol>
            {{PageData::Error()}}
            @if ($userInformation->getGroup()->getId()=='leader')
            <div class='panel-body row'>
                {{Form::button("Create New <i class='fa fa-plus'></i>",
                                array('class'=>'btn btn-primary pull-right',
                                'onClick'=>"location.href='".url('project/create')."'"))}}
            </div>
            @endif
            <div class="">
                <table class="table table-striped table-bordered table-hover" id="tbl_data_user">
                    <thead>
                        <tr>
                        @if ($userInformation->getGroup()->getId()=='leader')
                        <th> </th>
                        @endif
                            <th>Nama</th>
                            <th>Start Date</th>
                            <th>Due Date</th>
                            <th>Created By</th>	
                        </tr>
                    </thead>
                    <tbody>
                        @if ($Model != null)
                            @foreach ($Model as $item)
                            @if ($userInformation->getGroup()->getId()=='leader')
                            <tr class="odd gradeX" onclick="">
                                <td class="text-center">
                                    <div class="btn-group btn-group-sm" role="group" aria-label="...">
                                        <button type="button" class="btn btn-default"
                                                onclick="location.href='{{ action('ProjectController@edit', $item->getId()) }}'">
                                            <i class="fa fa-edit text-primary"></i>
                                        </button>

                                    </div>
                                </td>
                                @endif
                                <td><a href="{{ action('ProjectController@detail', $item->getId()) }}">{{ $item->getName() }}</a></td>
                                <td>{{ $item->getStartDate() }}</td>
                                <td>{{ $item->getDueDate() }}</td>
                                <td class="text-center">{{ $item->getCreatedBy()!=null ? $item->getCreatedBy()->getName() : "-" }}</td>
                            </tr>
                            @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
            <!-- /.table-responsive -->
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /.container-fluid -->
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
        $('#tbl_data_user').dataTable(
        );
    });
    </script>
@stop